import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';

import { HttpService } from '../../../service/httpService';
import { NativeService } from '../../../service/NativeService';
import { UserService } from '../../../service/userService';
@Component({
  selector: 'page-transaction',
  templateUrl: 'transaction.html',
})
export class TransactionPage {

  private data:any;
  private showLoading = true;
  constructor(public navCtrl: NavController,
              public http:HttpService,
              public nat:NativeService,
              public user:UserService,
              public navParams: NavParams) {
    this.getData();
  }


  getData(){

    let map = {
      pageIndex:0,
      pageSize:30,
      startDate:'',
      endDate:''
    };
    let url = '/api/User/GetUserConsumeList';
    let self = this;
    this.http.get(url,map,function (res,err) {
      self.showLoading = false;
      if(!err){
        for(var i=0;i<res.data.length;i++){
          let item = res.data[i];
          switch (item.Type){
            case 4:
            case 3:
              item.typeStr = "转账";
                  break;
            case 2:
              item.typeStr = "取款";
              item.Remark = "";
                  break;
            case 1:
              item.typeStr = "存款";
              item.Remark = "";
                  break;
            default:
              break;
          }
        }
        self.data = res.data;
        console.log(self.data);
      }
    });


  }



}
